package index

import (
	"context"
	"xr-game-server/core/httpserver"
	"xr-game-server/dao/resdao"
	"xr-game-server/dao/roledao"
	"xr-game-server/dto/indexdto"
	"xr-game-server/dto/resdto"
)

func GetAll(ctx context.Context, req *indexdto.IndexReq) (resp *indexdto.IndexRes, err error) {
	roleId := httpserver.GetAuthId(ctx)
	resData := resdao.GetResBy(roleId)
	resDto := resdto.NewArrayResDto(resData)
	roleData := roledao.GetRoleByRole(roleId)
	return indexdto.NewIndexRes(resDto, roleData), nil
}
